#include "cpu/exec/template-start.h"

make_helper(concat(movs_, SUFFIX)) {
	swaddr_t src = (DATA_BYTE == 2 ? reg_w(R_SI) : reg_l(R_ESI));
	swaddr_t des = (DATA_BYTE == 2 ? reg_w(R_DI) : reg_l(R_EDI));
	int inc;
	MEM_W(des, S_ES, MEM_R(src, S_DS));
	if (cpu.DF == 0) {
		inc = DATA_BYTE;
	}
	else {
		inc = - DATA_BYTE;
	}
	if (DATA_BYTE == 2) {
		reg_w(R_SI) += inc;
		reg_w(R_DI) += inc;
	}
	else {
		reg_l(R_ESI) += inc;
		reg_l(R_EDI) += inc;
	}

	print_asm("movs" str(SUFFIX));
	return 1;
}


#include "cpu/exec/template-end.h"
